package com.tb.dubbo_service;

import com.tb.dubbo.IorderStatusService;
import com.tb.mapper.OrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * @创建人 lxq
 * @创建时间 2019/1/14
 * @描述 根据用户id查询订单待付款数量，待收货数量，待评价数量
 */
@Service
public class OrderStatusImpl implements IorderStatusService {
    @Autowired
    private OrderMapper orderMapper;



    @Override
    public Map<String, Object> getOrderStatus(String userId) {
       Map<String, Object> map=new HashMap<>();

       map.put("DFK",this.getDFK(userId));

       map.put("DSH",this.getDSH(userId));

       map.put("DPJ",this.getDPJ(userId));


       return map;
     }
    //待付款数量
    public  int getDFK(String userId){
        return orderMapper.countDFKByStatus4( userId);
    }
    //待收货数量
    public  int getDSH(String userId){
        return orderMapper.countDFKByStatus2( userId);
    }
    //待评价数量
    public  int getDPJ(String userId){
        return orderMapper.countDPJByStatus6(userId);
    }
}
